package com.byb.server.service.mapper;

import com.byb.server.domain.*;
import com.byb.server.service.dto.IllnessInfoDTO;

import org.mapstruct.*;

/**
 * Mapper for the entity IllnessInfo and its DTO IllnessInfoDTO.
 */
@Mapper(componentModel = "spring", uses = {TypeOfCaseMapper.class, ProductMapper.class, })
public interface IllnessInfoMapper extends EntityMapper <IllnessInfoDTO, IllnessInfo> {

    @Mapping(source = "typeOfCase.id", target = "typeOfCaseId")
    @Mapping(source = "typeOfCase.typeName", target = "typeOfCaseTypeName")

    @Mapping(source = "product.id", target = "productId")
    IllnessInfoDTO toDto(IllnessInfo illnessInfo); 

    @Mapping(source = "typeOfCaseId", target = "typeOfCase")

    @Mapping(source = "productId", target = "product")
    IllnessInfo toEntity(IllnessInfoDTO illnessInfoDTO); 
    default IllnessInfo fromId(Long id) {
        if (id == null) {
            return null;
        }
        IllnessInfo illnessInfo = new IllnessInfo();
        illnessInfo.setId(id);
        return illnessInfo;
    }
}
